<#assign actionname>${(action=='create')?string('新建','编辑')}</#assign>
<@override name="title">${actionname}品牌活动</@override>
<@override name="viewcss">
<link rel="stylesheet" href="${ctx}/static/scripts/plugins/bootstrap-switch/css/bootstrap-switch.min.css" type="text/css"/>
</@override>
<@override name="viewbody">
<div class="row">
    <div class="col-md-12">
        <h3 class="page-title">
        ${actionname}品牌活动
            <small>${actionname}品牌活动.</small>
        </h3>
        <ul class="page-breadcrumb breadcrumb">
            <li>
                <i class="fa fa-home"></i>
                <a href="${ctx}/admin/home">
                    首页
                </a>
                <i class="fa fa-angle-right"></i>
            </li>
            <li>
                <a href="${ctx}/admin/brandActivity">品牌活动管理</a>
                <i class="fa fa-angle-right"></i>
            </li>
            <li><a href="#">${actionname}品牌活动</a></li>
        </ul>
    </div>
</div>

<div class="portlet box blue">
    <div class="portlet-title">
        <div class="caption">
            <i class="fa fa-reorder"></i> 品牌活动信息
        </div>
    </div>
    <div class="portlet-body">
        <form class="form-horizontal" action="${ctx}/admin/activity/brandActivity/save" role="form" id="brandForm"
              method="post">
            <input name="activity.id" type="hidden" value="${activity.id!}"/>

            <div class="form-group">
                <label class="col-sm-2 control-label" for="brandName">活动名称: <span
                        class="required">*</span></label>

                <div class="col-sm-10">
                    <input type="text" class="required form-control input-xlarge" placeholder="活动名称"
                           name="activity.name" id="brandName" value="${activity.name!}">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label" for="begin_time">开始时间: <span  class="required">*</span></label>

                <div class="col-sm-10">
                    <div class="input-group input-medium date form_datetime" data-link-field="begin_time">
                        <input class="required form-control" size="16" type="text"
                               value="<#if activity.begin_time??>${activity.begin_time?string('yyyy-MM-dd HH:mm:ss')}</#if>"
                               name="activity.begin_time"
                               id="begin_time">
                        <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
                        <span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
                    </div>
                    <input type="hidden" id="activity.begin_time" name="begin_time" value="">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label" for="end_time">结束时间: <span class="required">*</span></label>

                <div class="col-sm-9">
                    <div class="input-group input-medium date  form_datetime" data-link-field="end_time">
                        <input class="required form-control" size="16" type="text"
                               value="<#if activity.end_time??>${activity.end_time?string('yyyy-MM-dd HH:mm:ss')}</#if>"
                               name="activity.end_time" id="end_time">
                        <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
                        <span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
                    </div>
                    <input type="hidden" id="activity.end_time" name="end_time" value=""/>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label" for="end_time">允许评论: <span class="required">*</span></label>

                <div class="col-sm-9">
                    <input type="checkbox" name="reply" <#if activity.reply??> <#if  activity.reply>checked</#if> <#else>checked </#if> class="make-switch switch-large"
                           data-label-icon="fa fa-fullscreen" data-on-label="<i class='fa fa-check'></i>"
                           data-off-label="<i class='fa fa-times'></i>">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label" for="bankSel">品牌选择:</label>

                <div class="col-sm-10">
                    <select data-placeholder="品牌选择" name="bankSel" id="bankSel"
                            class="required form-control input-xlarge select2me" multiple="" tabindex="-1">
                        <option value=""></option>
                        <#if brandList??>
                            <#list brandList as item>
                                <option value="${item.id},${item.name}"
                                        <#if activity.brand_names?? && activity.brand_names?contains(item.name)>selected="selected" </#if>>${item.name}</option>
                            </#list>
                        </#if>
                    </select>
                </div>
            </div>

            <div class="form-group">
                <label class="col-md-2 control-label" for="mo_prictures">活动图片： </label>

                <div class="col-md-10">
                    <p class="form-control-static">
                        <input id="prictureAttachmentUpload" type="file" class="btn">
                    </p>
                    <input type="hidden" id="mo_prictures" name="activity.picture" value="${activity.picture!}">
                    <ul class="list-inline blog-images" id="picture-grid">
                        <#if pics??>
                            <#list pics as pic>
                                <li class="picture">
                                    <a href="${ctx}${pic}" class="fancybox-button" data-rel="fancybox-button">
                                        <img class="" src="${ctx}${pic?replace('.','.thumbnail.')}" alt="">
                                    </a>
                                    <a href="#" class="action" data-hook="remove_picture" data-target="#mo_prictures"
                                       data-data="${pic!}"><i class="fa fa-times"></i> </a>
                                </li>
                            </#list>
                        </#if>
                    </ul>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label" for="description">活动描述:</label>

                <div class="col-sm-10">
                    <textarea rows="5" cols="5" id="description" class="form-control"
                              name="activity.description"
                              placeholder="请输入活动描述">${activity.description!}</textarea>
                </div>
            </div>


            <div class="form-actions text-right">

                <a class="btn default yellow-stripe" href="${ctx}/admin/activity/brandActivity"><i class="fa fa-arrow-circle-o-left"></i> 返回</a>
                <input type="submit" value="保存" class="btn btn-primary">
            </div>

        </form>
    </div>

</div>

<script id="showpics-template" type="text/x-handlebars-template">
    <li class="picture">
        <a href="{{ctx}}{{preview}}" class="fancybox-button" data-rel="fancybox-button">
            <img class="" src="{{ctx}}{{data}}" alt="">
        </a>
        <a href="#" class="action" data-hook="remove_picture" data-target="#mo_prictures"
           data-data="{{preview}}"><i class="fa fa-times"></i> </a>
    </li>
</script>

</@override>

<@override name="viewmodule">brand_activity_item</@override>
<@extends name="../../_basic/main.ftl"></@extends>